
/****** Object:  StoredProcedure [usp_GetReff_StatusByID]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_GetReff_StatusByID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_GetReff_StatusByID];
GO

CREATE PROCEDURE [usp_GetReff_StatusByID]
(
	@StatusID int
)
AS
BEGIN
	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[StatusID],
		[StatusName],
		[Description]
	FROM [Reff_Status]
	WHERE
		([StatusID] = @StatusID)

	SET @Err = @@Error

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_GetAllReff_Status]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_GetAllReff_Status]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_GetAllReff_Status];
GO

CREATE PROCEDURE [usp_GetAllReff_Status]
AS
BEGIN

	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[StatusID],
		[StatusName],
		[Description]
	FROM [Reff_Status]

	SET @Err = @@Error

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_UpdateReff_Status]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_UpdateReff_Status]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_UpdateReff_Status];
GO

CREATE PROCEDURE [usp_UpdateReff_Status]
(
	@StatusID int,
	@StatusName varchar(50) = NULL,
	@Description varchar(MAX) = NULL
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	UPDATE [Reff_Status]
	SET
		[StatusName] = @StatusName,
		[Description] = @Description
	WHERE
		[StatusID] = @StatusID


	SET @Err = @@Error


	RETURN @Err
END
GO




/****** Object:  StoredProcedure [usp_InsertReff_Status]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_InsertReff_Status]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_InsertReff_Status];
GO

CREATE PROCEDURE [usp_InsertReff_Status]
(
	@StatusID int = NULL output,
	@StatusName varchar(50) = NULL,
	@Description varchar(MAX) = NULL
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	INSERT
	INTO [Reff_Status]
	(
		[StatusName],
		[Description]
	)
	VALUES
	(
		@StatusName,
		@Description
	)

	SET @Err = @@Error

	SELECT @StatusID = SCOPE_IDENTITY()

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_DeleteReff_Status]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_DeleteReff_Status]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_DeleteReff_Status];
GO

CREATE PROCEDURE [usp_DeleteReff_Status]
(
	@StatusID int
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	DELETE
	FROM [Reff_Status]
	WHERE
		[StatusID] = @StatusID
	SET @Err = @@Error

	RETURN @Err
END
GO

